home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group95b.txt
/
000032_icon-group-sender _Wed May 31 13:53:35 1995.msg
< prev
next >
Wrap
Internet Message Format
|
1995-09-18
|
1KB
Received: by cheltenham.cs.arizona.edu; Thu, 1 Jun 1995 10:38:30 MST
To: icon-group-l@cs.arizona.edu
Date: 31 May 1995 13:53:35 -0700
From: dave@cs.arizona.edu (Dave Schaumann)
Message-Id: <3qil0f$dnd@lectura.CS.Arizona.EDU>
Organization: University of Arizona CS Department, Tucson AZ
Sender: icon-group-request@cs.arizona.edu
References: <KRINKE.95May30183109@infbspsk.cs.tu-bs.de>
Subject: Re: problem with 'key'
Errors-To: icon-group-errors@cs.arizona.edu
In article <KRINKE.95May30183109@infbspsk.cs.tu-bs.de>,
Jens Krinke <krinke@ips.cs.tu-bs.de> wrote:
>Hi,
>
>i have a problem with 'key': example:
>
>record test(foo, bar)
>
>procedure main()
> a := table()
> a[test(3,4)] := "a(3,4)"
> a[test(1,2)] := "a(1,2)"
> every write("entry: ", image(!a))
> every write("key: ", image(!key(a)))
^
> every k := !key(a) do
^
> write("check: ", image(a[k]))
"key" is already a generator -- there's no need to use the '!' operator
with it. The reason you are getting the results you are is that key()
returns first the record "a(1,2)". Then '!' causes iteration over the
fields of that record, giving the result you see in the first loop.
Similarly in the second loop, 'k' goes over the values 1, 2, 3, and 4.
None of these are keys in your table, and so all references have the
default (&null) value.
-Dave